package com.atguigu.gmall.item.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.item.service.api.ItemService;
import com.atguigu.gmall.model.product.SkuInfo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author: 封捷
 * @create-date: 2022/8/24 14:32
 */
@Api(tags = "商品详情页数据汇总接口")
@RestController
@RequestMapping("/api/item")
public class ItemController {

    @Autowired
    private ItemService itemService;

    @GetMapping("/{skuId}")
    public Result<Map<String, Object>> getSkuInfoById(@PathVariable("skuId") Long skuId) {

        Map<String, Object> skuInfoMap = itemService.getSkuInfoById(skuId);

        return Result.ok(skuInfoMap);
    }

}
